﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_StaffLogin]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_StaffLogin];
GO
CREATE PROCEDURE [dbo].[sproc_StaffLogin]
    @username		nvarchar(25),
    @password       nvarchar(25),
    @UserID			int OUTPUT,
    @IsNeedKey      bit OUTPUT
/*

============================================================
功能:    员工登陆 判断是否登陆成功
参数:
    @username            nvarchar(25)        :    登陆名
    @password            nvarchar(25),        :    登陆密码
    @UserID          int OUTPUT    ;    用户ID

============================================================

*/
AS
BEGIN
    set nocount on;

    SELECT @UserID = Staff_ID, @IsNeedKey = IsNeedKey
    FROM dbo.UDS_Staff
    WHERE (Staff_Name = @username) AND (password = @Password collate Latin1_General_CS_AS);

    IF @@Rowcount < 1
    BEGIN
        SELECT @UserID = -1, @IsNeedKey = 0;
    END
END
GO